package day04;

public class Method02 {                                       //写找数组最大值的方法
    public static int maxarr(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {max = arr[i];}
        }
        return max;
    }
    public static void main(String[] args) {
        int[] arr1={1,2,3,4,5};
        System.out.println(maxarr(arr1));
    }
}
